function GAD_Etom_PV_Dist_Plot(Data_Summary)
%% Step 1: Collect all Data

% G2_F4_17
[G17_saline, G17_saline_shuffle] = PV_Mean_Dist_One_Animal_One_Dose(Data_Summary, 'saline', 'G2_F4_17');
[G17_e2, G17_e2_shuffle] = PV_Mean_Dist_One_Animal_One_Dose(Data_Summary, 'etomidate 2mg/kg', 'G2_F4_17');
[G17_e4, G17_e4_shuffle] = PV_Mean_Dist_One_Animal_One_Dose(Data_Summary, 'etomidate 4mg/kg', 'G2_F4_17');
[G17_e6, G17_e6_shuffle] = PV_Mean_Dist_One_Animal_One_Dose(Data_Summary, 'etomidate 6mg/kg', 'G2_F4_17');
[G17_e7, G17_e7_shuffle] = PV_Mean_Dist_One_Animal_One_Dose(Data_Summary, 'etomidate 7mg/kg', 'G2_F4_17');
[G17_e8, G17_e8_shuffle] = PV_Mean_Dist_One_Animal_One_Dose(Data_Summary, 'etomidate 8mg/kg', 'G2_F4_17');

% G2_F4_18
[G18_saline, G18_saline_shuffle] = PV_Mean_Dist_One_Animal_One_Dose(Data_Summary, 'saline', 'G2_F4_18');
[G18_e2, G18_e2_shuffle] = PV_Mean_Dist_One_Animal_One_Dose(Data_Summary, 'etomidate 2mg/kg', 'G2_F4_18');
[G18_e4, G18_e4_shuffle] = PV_Mean_Dist_One_Animal_One_Dose(Data_Summary, 'etomidate 4mg/kg', 'G2_F4_18');
[G18_e6, G18_e6_shuffle] = PV_Mean_Dist_One_Animal_One_Dose(Data_Summary, 'etomidate 6mg/kg', 'G2_F4_18');
[G18_e7, G18_e7_shuffle] = PV_Mean_Dist_One_Animal_One_Dose(Data_Summary, 'etomidate 7mg/kg', 'G2_F4_18');
[G18_e8, G18_e8_shuffle] = PV_Mean_Dist_One_Animal_One_Dose(Data_Summary, 'etomidate 8mg/kg', 'G2_F4_18');

% G2_F5(2)_21
[G21_saline, G21_saline_shuffle] = PV_Mean_Dist_One_Animal_One_Dose(Data_Summary, 'saline', 'G2_F5(2)_21');
[G21_e2, G21_e2_shuffle] = PV_Mean_Dist_One_Animal_One_Dose(Data_Summary, 'etomidate 2mg/kg', 'G2_F5(2)_21');
[G21_e4, G21_e4_shuffle] = PV_Mean_Dist_One_Animal_One_Dose(Data_Summary, 'etomidate 4mg/kg', 'G2_F5(2)_21');
[G21_e6, G21_e6_shuffle] = PV_Mean_Dist_One_Animal_One_Dose(Data_Summary, 'etomidate 6mg/kg', 'G2_F5(2)_21');
[G21_e7, G21_e7_shuffle] = PV_Mean_Dist_One_Animal_One_Dose(Data_Summary, 'etomidate 7mg/kg', 'G2_F5(2)_21');
[G21_e8, G21_e8_shuffle] = PV_Mean_Dist_One_Animal_One_Dose(Data_Summary, 'etomidate 8mg/kg', 'G2_F5(2)_21');

% G2_F5(2)_28 (doesn't have data for etomidate 8mg/kg because of total sedation)
[G28_saline, G28_saline_shuffle] = PV_Mean_Dist_One_Animal_One_Dose(Data_Summary, 'saline', 'G2_F5(2)_28');
[G28_e2, G28_e2_shuffle] = PV_Mean_Dist_One_Animal_One_Dose(Data_Summary, 'etomidate 2mg/kg', 'G2_F5(2)_28');
[G28_e4, G28_e4_shuffle] = PV_Mean_Dist_One_Animal_One_Dose(Data_Summary, 'etomidate 4mg/kg', 'G2_F5(2)_28');
[G28_e6, G28_e6_shuffle] = PV_Mean_Dist_One_Animal_One_Dose(Data_Summary, 'etomidate 6mg/kg', 'G2_F5(2)_28');
[G28_e7, G28_e7_shuffle] = PV_Mean_Dist_One_Animal_One_Dose(Data_Summary, 'etomidate 7mg/kg', 'G2_F5(2)_28');

% G2_F5(2)_31
[G31_saline, G31_saline_shuffle] = PV_Mean_Dist_One_Animal_One_Dose(Data_Summary, 'saline', 'G2_F5(2)_31');
[G31_e2, G31_e2_shuffle] = PV_Mean_Dist_One_Animal_One_Dose(Data_Summary, 'etomidate 2mg/kg', 'G2_F5(2)_31');
[G31_e4, G31_e4_shuffle] = PV_Mean_Dist_One_Animal_One_Dose(Data_Summary, 'etomidate 4mg/kg', 'G2_F5(2)_31');
[G31_e6, G31_e6_shuffle] = PV_Mean_Dist_One_Animal_One_Dose(Data_Summary, 'etomidate 6mg/kg', 'G2_F5(2)_31');
[G31_e7, G31_e7_shuffle] = PV_Mean_Dist_One_Animal_One_Dose(Data_Summary, 'etomidate 7mg/kg', 'G2_F5(2)_31');
[G31_e8, G31_e8_shuffle] = PV_Mean_Dist_One_Animal_One_Dose(Data_Summary, 'etomidate 8mg/kg', 'G2_F5(2)_31');

% G2_F5(2)_34
[G34_saline, G34_saline_shuffle] = PV_Mean_Dist_One_Animal_One_Dose(Data_Summary, 'saline', 'G2_F5(2)_34');
[G34_e2, G34_e2_shuffle] = PV_Mean_Dist_One_Animal_One_Dose(Data_Summary, 'etomidate 2mg/kg', 'G2_F5(2)_34');
[G34_e4, G34_e4_shuffle] = PV_Mean_Dist_One_Animal_One_Dose(Data_Summary, 'etomidate 4mg/kg', 'G2_F5(2)_34');
[G34_e6, G34_e6_shuffle] = PV_Mean_Dist_One_Animal_One_Dose(Data_Summary, 'etomidate 6mg/kg', 'G2_F5(2)_34');
[G34_e7, G34_e7_shuffle] = PV_Mean_Dist_One_Animal_One_Dose(Data_Summary, 'etomidate 7mg/kg', 'G2_F5(2)_34');
[G34_e8, G34_e8_shuffle] = PV_Mean_Dist_One_Animal_One_Dose(Data_Summary, 'etomidate 8mg/kg', 'G2_F5(2)_34');

% G2_F5(2)_45
[G45_saline, G45_saline_shuffle] = PV_Mean_Dist_One_Animal_One_Dose(Data_Summary, 'saline', 'G2_F5(2)_45');
[G45_e2, G45_e2_shuffle] = PV_Mean_Dist_One_Animal_One_Dose(Data_Summary, 'etomidate 2mg/kg', 'G2_F5(2)_45');
[G45_e4, G45_e4_shuffle] = PV_Mean_Dist_One_Animal_One_Dose(Data_Summary, 'etomidate 4mg/kg', 'G2_F5(2)_45');
[G45_e6, G45_e6_shuffle] = PV_Mean_Dist_One_Animal_One_Dose(Data_Summary, 'etomidate 6mg/kg', 'G2_F5(2)_45');
[G45_e7, G45_e7_shuffle] = PV_Mean_Dist_One_Animal_One_Dose(Data_Summary, 'etomidate 7mg/kg', 'G2_F5(2)_45');
[G45_e8, G45_e8_shuffle] = PV_Mean_Dist_One_Animal_One_Dose(Data_Summary, 'etomidate 8mg/kg', 'G2_F5(2)_45');

% G2_F5(2)_53
[G53_saline, G53_saline_shuffle] = PV_Mean_Dist_One_Animal_One_Dose(Data_Summary, 'saline', 'G2_F5(2)_53');
[G53_e2, G53_e2_shuffle] = PV_Mean_Dist_One_Animal_One_Dose(Data_Summary, 'etomidate 2mg/kg', 'G2_F5(2)_53');
[G53_e4, G53_e4_shuffle] = PV_Mean_Dist_One_Animal_One_Dose(Data_Summary, 'etomidate 4mg/kg', 'G2_F5(2)_53');
[G53_e6, G53_e6_shuffle] = PV_Mean_Dist_One_Animal_One_Dose(Data_Summary, 'etomidate 6mg/kg', 'G2_F5(2)_53');
[G53_e7, G53_e7_shuffle] = PV_Mean_Dist_One_Animal_One_Dose(Data_Summary, 'etomidate 7mg/kg', 'G2_F5(2)_53');
[G53_e8, G53_e8_shuffle] = PV_Mean_Dist_One_Animal_One_Dose(Data_Summary, 'etomidate 8mg/kg', 'G2_F5(2)_53');


%% Step 2: Organize & Summarize Data

% for WT animals
WT_saline = cat(1, G18_saline, G28_saline, G31_saline, G34_saline); 
WT_saline_shuffle = cat(1, G18_saline_shuffle, G28_saline_shuffle, G31_saline_shuffle, G34_saline_shuffle);
for n = 1:size(WT_saline, 2)
    WT_saline_M (1,n) = mean(WT_saline(:,n));
    WT_saline_SE (1,n) = calculate_standard_error(WT_saline(:,n));
    WT_saline_shuffle_M (1,n) = mean(WT_saline_shuffle(:,n));
end

WT_e2 = cat(1, G18_e2, G28_e2, G31_e2, G34_e2);
WT_e2_shuffle = cat(1, G18_e2_shuffle, G28_e2_shuffle, G31_e2_shuffle, G34_e2_shuffle);
for n = 1:size(WT_e2, 2)
    WT_e2_M (1,n) = mean(WT_e2(:,n));
    WT_e2_SE (1,n) = calculate_standard_error(WT_e2(:,n));
    WT_e2_shuffle_M (1,n) = mean(WT_e2_shuffle(:,n));
end

WT_e4 = cat(1, G18_e4, G28_e4, G31_e4, G34_e4);
WT_e4_shuffle = cat(1, G18_e4_shuffle, G28_e4_shuffle, G31_e4_shuffle, G34_e4_shuffle);
for n = 1:size(WT_e4, 2)
    WT_e4_M (1,n) = mean(WT_e4(:,n));
    WT_e4_SE (1,n) = calculate_standard_error(WT_e4(:,n));
    WT_e4_shuffle_M (1,n) = mean(WT_e4_shuffle(:,n));
end

WT_e6 = cat(1, G18_e6, G28_e6, G31_e6, G34_e6);
WT_e6_shuffle = cat(1, G18_e6_shuffle, G28_e6_shuffle, G31_e6_shuffle, G34_e6_shuffle);
for n = 1:size(WT_e6, 2)
    WT_e6_M (1,n) = mean(WT_e6(:,n));
    WT_e6_SE (1,n) = calculate_standard_error(WT_e6(:,n));
    WT_e6_shuffle_M (1,n) = mean(WT_e6_shuffle(:,n));
end

WT_e7 = cat(1, G18_e7, G28_e7, G31_e7, G34_e7);
WT_e7_shuffle = cat(1, G18_e7_shuffle, G28_e7_shuffle, G31_e7_shuffle, G34_e7_shuffle);
for n = 1:size(WT_e7, 2)
    WT_e7_M (1,n) = mean(WT_e7(:,n));
    WT_e7_SE (1,n) = calculate_standard_error(WT_e7(:,n));
    WT_e7_shuffle_M (1,n) = mean(WT_e7_shuffle(:,n));
end

WT_e8 = cat(1, G18_e8, G31_e8, G34_e8);
WT_e8_shuffle = cat(1, G18_e8_shuffle, G31_e8_shuffle, G34_e8_shuffle);
for n = 1:size(WT_e8, 2)
    WT_e8_M (1,n) = mean(WT_e8(:,n));
    WT_e8_SE (1,n) = calculate_standard_error(WT_e8(:,n));
    WT_e8_shuffle_M (1,n) = mean(WT_e8_shuffle(:,n));
end


% for MUT animals
MUT_saline = cat(1, G17_saline, G21_saline, G45_saline, G53_saline); 
MUT_saline_shuffle = cat(1, G17_saline_shuffle, G21_saline_shuffle, G45_saline_shuffle, G53_saline_shuffle);
for n = 1:size(MUT_saline, 2)
    MUT_saline_M (1,n) = mean(MUT_saline(:,n));
    MUT_saline_SE (1,n) = calculate_standard_error(MUT_saline(:,n));
    MUT_saline_shuffle_M (1,n) = mean(MUT_saline_shuffle(:,n));
end

MUT_e2 = cat(1, G17_e2, G21_e2, G45_e2, G53_e2);
MUT_e2_shuffle = cat(1, G17_e2_shuffle, G21_e2_shuffle, G45_e2_shuffle, G53_e2_shuffle);
for n = 1:size(MUT_e2, 2)
    MUT_e2_M (1,n) = mean(MUT_e2(:,n));
    MUT_e2_SE (1,n) = calculate_standard_error(MUT_e2(:,n));
    MUT_e2_shuffle_M (1,n) = mean(MUT_e2_shuffle(:,n));
end

MUT_e4 = cat(1, G17_e4, G21_e4, G45_e4, G53_e4);
MUT_e4_shuffle = cat(1, G17_e4_shuffle, G21_e4_shuffle, G45_e4_shuffle, G53_e4_shuffle);
for n = 1:size(MUT_e4, 2)
    MUT_e4_M (1,n) = mean(MUT_e4(:,n));
    MUT_e4_SE (1,n) = calculate_standard_error(MUT_e4(:,n));
    MUT_e4_shuffle_M (1,n) = mean(MUT_e4_shuffle(:,n));
end

MUT_e6 = cat(1, G17_e6, G21_e6, G45_e6, G53_e6);
MUT_e6_shuffle = cat(1, G17_e6_shuffle, G21_e6_shuffle, G45_e6_shuffle, G53_e6_shuffle);
for n = 1:size(MUT_e6, 2)
    MUT_e6_M (1,n) = mean(MUT_e6(:,n));
    MUT_e6_SE (1,n) = calculate_standard_error(MUT_e6(:,n));
    MUT_e6_shuffle_M (1,n) = mean(MUT_e6_shuffle(:,n));
end

MUT_e7 = cat(1, G17_e7, G21_e7, G45_e7, G53_e7);
MUT_e7_shuffle = cat(1, G17_e7_shuffle, G21_e7_shuffle, G45_e7_shuffle, G53_e7_shuffle);
for n = 1:size(MUT_e7, 2)
    MUT_e7_M (1,n) = mean(MUT_e7(:,n));
    MUT_e7_SE (1,n) = calculate_standard_error(MUT_e7(:,n));
    MUT_e7_shuffle_M (1,n) = mean(MUT_e7_shuffle(:,n));
end

MUT_e8 = cat(1, G17_e8, G21_e8, G45_e8, G53_e8);
MUT_e8_shuffle = cat(1, G17_e8_shuffle, G21_e8_shuffle, G45_e8_shuffle, G53_e8_shuffle);
for n = 1:size(MUT_e8, 2)
    MUT_e8_M (1,n) = mean(MUT_e8(:,n));
    MUT_e8_SE (1,n) = calculate_standard_error(MUT_e8(:,n));
    MUT_e8_shuffle_M (1,n) = mean(MUT_e8_shuffle(:,n));
end

%% plotting 

% define boundary
Upper_Bound=1;
Lower_Bound=-1; 
Interval=0.05; 

figure
subplot(2,6,1)
bar((Lower_Bound+0.5*Interval:Interval:Upper_Bound),WT_saline_M,1,'b','FaceAlpha',1);
xlim([-0.6 1]); ylim([0 0.3]);
xlabel('PV Correlation');
ylabel('Spatial Fraction');
hold on
er = errorbar((Lower_Bound+0.5*Interval:Interval:Upper_Bound), WT_saline_M, [], WT_saline_SE,'LineWidth',1);    
er.Color = [0 0 0];                            
er.LineStyle = 'None'; 
hold on
plot((Lower_Bound+Interval:Interval:Upper_Bound),WT_saline_shuffle_M,'--k','lineWidth',2);
hold off
set(gca,'FontSize',18); 
title('Saline','FontSize',20);

subplot(2,6,2)
bar((Lower_Bound+0.5*Interval:Interval:Upper_Bound),WT_e2_M,1,'b','FaceAlpha',0.8);
xlim([-0.6 1]); ylim([0 0.3]);
hold on
er = errorbar((Lower_Bound+0.5*Interval:Interval:Upper_Bound),WT_e2_M,[],WT_e2_SE,'LineWidth',1);    
er.Color = [0 0 0];                            
er.LineStyle = 'None';
hold on
plot((Lower_Bound+Interval:Interval:Upper_Bound),WT_e2_shuffle_M,'--k','lineWidth',2);
hold off
set(gca,'FontSize',18); 
title('ETOM 2mg/kg','FontSize',20);

subplot(2,6,3)
bar((Lower_Bound+0.5*Interval:Interval:Upper_Bound),WT_e4_M,1,'b','FaceAlpha',0.6);
xlim([-0.6 1]); ylim([0 0.3]);
hold on
er = errorbar((Lower_Bound+0.5*Interval:Interval:Upper_Bound),WT_e4_M,[],WT_e4_SE,'LineWidth',1);    
er.Color = [0 0 0];                            
er.LineStyle = 'None';
hold on
plot((Lower_Bound+Interval:Interval:Upper_Bound),WT_e4_shuffle_M,'--k','lineWidth',2);
hold off
set(gca,'FontSize',18); 
title('4mg/kg','FontSize',20);

subplot(2,6,4)
bar((Lower_Bound+0.5*Interval:Interval:Upper_Bound),WT_e6_M,1,'b','FaceAlpha',0.5);
xlim([-0.6 1]); ylim([0 0.3]);
hold on
er = errorbar((Lower_Bound+0.5*Interval:Interval:Upper_Bound),WT_e6_M,[],WT_e6_SE,'LineWidth',1);    
er.Color = [0 0 0];                            
er.LineStyle = 'None';
hold on
plot((Lower_Bound+Interval:Interval:Upper_Bound),WT_e6_shuffle_M,'--k','lineWidth',2);
hold off
set(gca,'FontSize',18); 
title('6mg/kg','FontSize',20);

subplot(2,6,5)
bar((Lower_Bound+0.5*Interval:Interval:Upper_Bound),WT_e7_M,1,'b','FaceAlpha',0.4);
xlim([-0.6 1]); ylim([0 0.3]);
hold on
er = errorbar((Lower_Bound+0.5*Interval:Interval:Upper_Bound),WT_e7_M,[],WT_e7_SE,'LineWidth',1);    
er.Color = [0 0 0];                            
er.LineStyle = 'None';
hold on
plot((Lower_Bound+Interval:Interval:Upper_Bound),WT_e7_shuffle_M,'--k','lineWidth',2);
hold off
set(gca,'FontSize',18); 
title('7mg/kg','FontSize',20);

subplot(2,6,6)
bar((Lower_Bound+0.5*Interval:Interval:Upper_Bound),WT_e8_M,1,'b','FaceAlpha',0.3);
xlim([-0.6 1]); ylim([0 0.3]);
hold on
er = errorbar((Lower_Bound+0.5*Interval:Interval:Upper_Bound),WT_e8_M,[],WT_e8_SE,'LineWidth',1);    
er.Color = [0 0 0];                            
er.LineStyle = 'None';
hold on
plot((Lower_Bound+Interval:Interval:Upper_Bound),WT_e8_shuffle_M,'--k','lineWidth',2);
hold off
set(gca,'FontSize',18); 
title('8mg/kg','FontSize',20);

subplot(2,6,7)
bar((Lower_Bound+0.5*Interval:Interval:Upper_Bound),MUT_saline_M,1,'m','FaceAlpha',1);
xlim([-0.6 1]); ylim([0 0.3]);
xlabel('PV Correlation');
ylabel('Spatial Fraction');
hold on
er = errorbar((Lower_Bound+0.5*Interval:Interval:Upper_Bound),MUT_saline_M, [], MUT_saline_SE,'LineWidth',1);    
er.Color = [0 0 0];                            
er.LineStyle = 'None'; 
hold on
plot((Lower_Bound+Interval:Interval:Upper_Bound),MUT_saline_shuffle_M,'--k','lineWidth',2);
hold off
set(gca,'FontSize',18); 
% title('\alpha5-i-KO Saline','FontSize',20);

subplot(2,6,8)
bar((Lower_Bound+0.5*Interval:Interval:Upper_Bound),MUT_e2_M,1,'m','FaceAlpha',0.8);
xlim([-0.6 1]); ylim([0 0.3]);
hold on
er = errorbar((Lower_Bound+0.5*Interval:Interval:Upper_Bound),MUT_e2_M,[],MUT_e2_SE,'LineWidth',1);    
er.Color = [0 0 0];                            
er.LineStyle = 'None';
hold on
plot((Lower_Bound+Interval:Interval:Upper_Bound),MUT_e2_shuffle_M,'--k','lineWidth',2);
hold off
set(gca,'FontSize',18); 
% title('ETOM 2mg/kg','FontSize',20);

subplot(2,6,9)
bar((Lower_Bound+0.5*Interval:Interval:Upper_Bound),MUT_e4_M,1,'m','FaceAlpha',0.6);
xlim([-0.6 1]); ylim([0 0.3]);
hold on
er = errorbar((Lower_Bound+0.5*Interval:Interval:Upper_Bound),MUT_e4_M,[],MUT_e4_SE,'LineWidth',1);    
er.Color = [0 0 0];                            
er.LineStyle = 'None';
hold on
plot((Lower_Bound+Interval:Interval:Upper_Bound),MUT_e4_shuffle_M,'--k','lineWidth',2);
hold off
set(gca,'FontSize',18); 
% title('ETOM 4mg/kg','FontSize',20);

subplot(2,6,10)
bar((Lower_Bound+0.5*Interval:Interval:Upper_Bound),MUT_e6_M,1,'m','FaceAlpha',0.5);
xlim([-0.6 1]); ylim([0 0.3]);
hold on
er = errorbar((Lower_Bound+0.5*Interval:Interval:Upper_Bound),MUT_e6_M,[],MUT_e6_SE,'LineWidth',1);    
er.Color = [0 0 0];                            
er.LineStyle = 'None';
hold on
plot((Lower_Bound+Interval:Interval:Upper_Bound),MUT_e6_shuffle_M,'--k','lineWidth',2);
hold off
set(gca,'FontSize',18); 
% title('ETOM 6mg/kg','FontSize',20);

subplot(2,6,11)
bar((Lower_Bound+0.5*Interval:Interval:Upper_Bound),MUT_e7_M,1,'m','FaceAlpha',0.4);
xlim([-0.6 1]); ylim([0 0.3]);
hold on
er = errorbar((Lower_Bound+0.5*Interval:Interval:Upper_Bound),MUT_e7_M,[],MUT_e7_SE,'LineWidth',1);    
er.Color = [0 0 0];                            
er.LineStyle = 'None';
hold on
plot((Lower_Bound+Interval:Interval:Upper_Bound),MUT_e7_shuffle_M,'--k','lineWidth',2);
hold off
set(gca,'FontSize',18); 
% title('ETOM 7mg/kg','FontSize',20);

subplot(2,6,12)
bar((Lower_Bound+0.5*Interval:Interval:Upper_Bound),MUT_e8_M,1,'m','FaceAlpha',0.3);
xlim([-0.6 1]); ylim([0 0.3]);
hold on
er = errorbar((Lower_Bound+0.5*Interval:Interval:Upper_Bound),MUT_e8_M,[],MUT_e8_SE,'LineWidth',1);    
er.Color = [0 0 0];                            
er.LineStyle = 'None';
hold on
plot((Lower_Bound+Interval:Interval:Upper_Bound),MUT_e8_shuffle_M,'--k','lineWidth',2);
hold off
set(gca,'FontSize',18); 
% title('ETOM 8mg/kg','FontSize',20);


end